package lab3;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;

public class BubbleSort {
    public int[] sort(int[] array) {
        if (array == null) {
            return null;
        }

        int[] res = Arrays.copyOf(array, array.length);

        for (int i = res.length - 1; i > 0; i--) {
            for (int j = 0; j < i; j++) {
                if (res[j]>res[j + 1]) {
                    int temp = res[j];
                    res[j] = res[j + 1];
                    res[j + 1] = temp;
                }
            }
        }

        return res;
    }

}
